package com.online.fund.spider.dao;

import java.util.List;
import java.util.Set;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import com.online.fund.spider.entity.SharesMoniterConfig;
import com.online.fund.spider.entity.SharesRefIdInfo;
import com.online.fund.spider.entity.SharesTransactionMoniterData;

@Repository
@Mapper
public interface SharesMoniterConfigDao {

	/**
	 * 查询股票是否存在
	 * @param sharesCode
	 * @return
	 */
	SharesRefIdInfo getSharesRefIdInfo(String sharesCode);

	void addSharesMoniterConfig(SharesMoniterConfig config);

	void updateSharesMoniterConfig(SharesMoniterConfig config);

	void deleteSharesMoniterConfig(Long id);

	SharesMoniterConfig getSharesMoniterConfigById(Long id);

	List<SharesMoniterConfig> getSharesMoniterConfigList(@Param("enabled") Integer enabled);

	/**
	 * 保存股票实时的价格数据
	 * @param moniterData
	 */
	void saveSharesTransactionMoniterData(SharesTransactionMoniterData moniterData);

	/**
	 * 获取待通知的数据列表
	 * @param notifyStatus
	 * @return
	 */
	List<SharesTransactionMoniterData> getSharesTransactionMoniterDataList(@Param("notifyStatus") Integer notifyStatus);

	/**
	 * 发送通知邮件后，更新数据的状态
	 * @param notifyStatus
	 * @param sharesTransactionMonitorId
	 */
	void updateSharesTransactionMoniterDataNotifyStatus(@Param("notifyStatus") Integer notifyStatus, @Param("sharesTransactionMonitorId") Long sharesTransactionMonitorId);

	/**
	 * 获取最后发送通知的数据，比较是否需要重新发送通知
	 * @param sharesCode
	 * @param monitorConfigId
	 * @return
	 */
	SharesTransactionMoniterData getLatestSharesTransactionMoniterData(@Param("sharesCode") String sharesCode, @Param("monitorConfigId") Long monitorConfigId);

	/**
	 * 获取公共假期
	 * @return
	 */
	Set<String> getHolidaySet();

}
